/**
 * 
 */
package com.meetingshow.privilege.uiservice.model;

import java.util.Date;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;

import com.meetingshow.common.base.uiservice.model.BaseVO;
import com.meetingshow.common.validator.RemoveValidator;
import com.meetingshow.common.validator.SaveValidator;
import com.meetingshow.common.validator.UpdateValidator;
import com.meetingshow.privilege.dao.model.UserPO;

/**
 * @author louyi
 *
 */
public class UserVO extends BaseVO {
    /**
     * 
     */
    private static final long serialVersionUID = -581582779186220198L;
    
    private Integer userId;
    private String userName;
    private String password;
    private Date createTime;
    private String userType;
    private String email;
    
    public UserVO() {
    }
    
    public UserVO (UserPO userPO) {
        setUserId(userPO.getUserId());
        setUserName(userPO.getUserName());
        setPassword(userPO.getPassword());
        setEmail(userPO.getEmail());
        setUserType(userPO.getUserType());
        setCreateTime(userPO.getCreateTime());
    }
    
    public UserPO toUserPO() {
        UserPO userPO = new UserPO();
        
        userPO.setUserId(getUserId());
        userPO.setUserName(getUserName());
        userPO.setPassword(getPassword());
        userPO.setEmail(getEmail());
        userPO.setUserType(getUserType());
        userPO.setCreateTime(getCreateTime());
        
        return userPO;
    }
    
    /**
     * @return the userId
     */
    @NotNull(groups={UpdateValidator.class, RemoveValidator.class})
    public Integer getUserId() {
        return userId;
    }
    /**
     * @param userId the userId to set
     */
    public void setUserId(Integer userId) {
        this.userId = userId;
    }
    /**
     * @return the userName
     */
    @NotBlank(groups={SaveValidator.class, UpdateValidator.class})
    public String getUserName() {
        return userName;
    }
    /**
     * @param userName the userName to set
     */
    public void setUserName(String userName) {
        this.userName = userName;
    }
    /**
     * @return the password
     */
    @NotBlank(groups={SaveValidator.class, UpdateValidator.class})
    @Size(max=20, groups={SaveValidator.class, UpdateValidator.class})
    public String getPassword() {
        return password;
    }
    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }
    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }
    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    /**
     * @return the userType
     */
    @NotBlank(groups={SaveValidator.class, UpdateValidator.class})
    @Size(max=1, groups={SaveValidator.class, UpdateValidator.class})
    public String getUserType() {
        return userType;
    }
    /**
     * @param userType the userType to set
     */
    public void setUserType(String userType) {
        this.userType = userType;
    }
    /**
     * @return the email
     */
    @NotBlank(groups={SaveValidator.class, UpdateValidator.class})
    @Size(max=50, groups={SaveValidator.class, UpdateValidator.class})
    @Email
    public String getEmail() {
        return email;
    }
    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }
}
